package rocket

import (
	mq_http_sdk "github.com/aliyunmq/mq-http-go-sdk"
	"log"
)

type ClientConf struct {
	Endpoint  string
	AccessKey string
	SecretKey string
}

type RocketClient struct {
	mq_http_sdk.MQClient
}

func NewClient(conf ClientConf) RocketClient {
	client := mq_http_sdk.NewAliyunMQClient(conf.Endpoint, conf.AccessKey, conf.SecretKey, "")
	return RocketClient{
		MQClient: client,
	}
}
func (client *RocketClient) GetPusher(conf PusherConf) pusher {

	return pusher{
		producer:    client.GetProducer(conf.InstanceId, conf.Topic),
		Tag:         conf.Tag,
		ShardingKey: conf.ShardingKey,
	}
}

func (client *RocketClient) GetDelayPusher(conf PusherConf) delayPusher {
	return delayPusher{
		producer: client.GetProducer(conf.InstanceId, conf.Topic),
		Tag:      conf.Tag,
	}
}

func (client *RocketClient) GetConsumer(conf ConsumerConf) {
	log.Fatal("get consumer not implement")
}
